package com.gzrobot.webCapTest.controller;

import com.gzrobot.gzCommon.bean.R;
import com.gzrobot.webCapTest.model.query.CaptureQuery;
import com.gzrobot.webCapTest.utils.CaptureUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Objects;

/**
 * @author : Cmy
 * @date : 2025-05-21 9:06
 */
@Slf4j
@RestController
@RequestMapping("webCamera")
public class WebCameraController {

    /**
     * 调用摄像头截图
     */
    @PostMapping("capture")
    public R capture(@RequestBody @Validated CaptureQuery captureQuery) {
        boolean success = CaptureUtils.captureByWay(captureQuery);
        return new R().check(success);
    }

}

